Repository navigation
E7: -fverify-* options for clang++ builds, a report per object, and quiet files without contracts - #120
Merged
Conversation
…erify-cache, and -fverify-report.
…'s file after the object.
…cpp-verify maps its own.
…out functions in it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan item E7 (verification inside
clang++builds): a compilation verified every file with the defaults (Z3, 30 s a query, one job) whatever it needed, and every file without contracts warned, so a build that gave-fverify-contractsto every file printed a warning for most of them.On the base
With this PR
cpp-verifyoption)-fverify-backend=z3|cvc5|portfolio|race|bmc--backend); Lean projects stay withcpp-verify-fverify-timeout=<ms>--timeout, 30000 by default, 0 disables); collections get twice it and a function ten times it, as withcpp-verify-fverify-jobs=<n>--jobs), 1 by default, since a build compiles several files at once-fverify-cache=<dir><dir>(--proof-cache), shared by every compilation that names it-fverify-report,-fverify-report=<file>--diagnostics-format=json), ending with the summary record, in<object>.cppverify.jsonbeside the object or in<file>A file without a function to verify says nothing (
cpp-verifystill warns for one: a run asked to verify it).Design
FrontendOptionsfields parsed by Clang's option marshalling (MarshallingInfoEnumfor the backend,MarshallingInfoIntfor the numbers), so an invalid value is the compiler's usual error, and the driver forwards them as it forwards-fverify-contracts-out=.-ftime-tracedoes. In a build the same flag goes to every file, so a bare-fverify-reportwrites<object>.cppverify.jsonbeside each object: the driver, which knows the output, passes-fverify-report=<path>to the compiler, as-ftime-tracenames its file after the object. The report is the recordscpp-verify --diagnostics-format=jsonprints, then the summary record; the summary record is built in one place now (summaryRecord), whichcpp-verifyuses too.compilationOptionsmaps the options ascpp-verifymaps--timeout,--jobs,--backend, and--proof-cache, including the timeouts a query timeout scales. The proof cache already writes atomically and prunes once per run, so compilations may share a directory.QuietWithoutFunctionsa file without contracts is no longer a warning.CodeGenActionpasses theFrontendOptionsinstead of one field.Tests
compile_options.cpp(new): the driver forwards every option and names a bare-fverify-report's file after the object, or keeps the file given; an invalid backend or timeout is the compiler's error; a file without contracts compiles with no output at all (count 0);-fverify-backend=bmcreaches the verifier ([backend=bmc, bound=0]), with a proof and a failure, and-fverify-report=holds both records and a summary of one verified and one failed;-fverify-cache=fills the directory.CompilationOptionsTest(new,VerifyTests): the defaults, which must equalcpp-verify's own, each option, every backend,-fverify-timeout=0disabling every limit as--timeout=0does, and the extremes (0 jobs is 1; a timeout too large to scale gives no collection and function bounds, ascpp-verify).On the base
compile_options.cppfails at its first option (unknown argument), and the file without contracts warns.On a release build of this branch, the whole Verify suite passes (505 of 506, one unsupported) once a stale
BUG_REPORT_URLin the local CMake cache is cleared; with itcrash_report_url.cppnames LLVM's tracker, which a fresh configure, as CI's, does not.Mutants
Each mutant below, applied alone and rebuilt, is caught (10 of 10):
-fverify-jobsis not forwardedcompile_options.cpp-fverify-reportis not named after the objectcompile_options.cppCompilationOptionsTestcompile_options.cppbmcverifies with Z3CompilationOptionsTestCompilationOptionsTestCompilationOptionsTestReview also found that
-fverify-timeout=0first meant the default, wherecpp-verify --timeout=0disables the limit; the option now defaults to 30000 and 0 disables, as for the tool.Docs
-fno-verifyfor development builds;Not done
-fverify-*options for the Lean backend, and for--functionor--max-failures: a compilation verifies the whole file with a solver.